Public Class CTransfer
    Inherits BOBase

    Protected m_State As TransferDS
    Protected m_DA As Transfers

#Region "   Inherits Implementation"
    Sub New()
        Throw New ApplicationException("Object does not support this method")
    End Sub

    Sub New(ByVal state As TransferDS, ByVal rowIndex As Integer)
        m_State = state
        m_DA = New Transfers
        MyBase.m_RowIndex = rowIndex
    End Sub

    Public Overrides ReadOnly Property DA() As DABase
        Get
            If m_DA Is Nothing Then
                m_DA = New Transfers
            End If

            Return m_DA
        End Get
    End Property

    Public Overrides Property ObjectState() As DataSet
        Get
            Return m_State
        End Get
        Set(ByVal Value As DataSet)
            Try
                m_State = CType(Value, TransferDS)
            Catch ex As InvalidCastException
                Throw New ApplicationException("Invalid TRANSFER Dataset!", ex)
            End Try
        End Set
    End Property

    Public Overrides Sub Init()
        Dim dr As TransferDS.TRANSFERRow = m_State.TRANSFER.NewTRANSFERRow
        With dr
            .PS_ID_FK = Nothing
            .PO_ID_FK = Nothing
            .QUANTITY = Nothing
        End With
        m_State.TRANSFER.Rows.Add(dr)
    End Sub
#End Region

#Region "   Data Properties"
    Protected ReadOnly Property DataRow() As TransferDS.TRANSFERRow
        Get
            Return CType(Me.Row, TransferDS.TRANSFERRow)
        End Get
    End Property

    Public ReadOnly Property ID() As System.Int32
        Get
            Return Me.DataRow.TRANS_ID_PK
        End Get
    End Property

    Public Property ProductionStatusID() As System.Int32
        Get
            Return Me.DataRow.PS_ID_FK
        End Get
        Set(ByVal Value As System.Int32)
            Me.DataRow.PS_ID_FK = Value
        End Set
    End Property

    Public Property PurchaseOrderID() As System.Int32
        Get
            Return Me.DataRow.PO_ID_FK
        End Get
        Set(ByVal Value As System.Int32)
            Me.DataRow.PO_ID_FK = Value
        End Set
    End Property

    Public Property Quantity() As System.Int32
        Get
            Return Me.DataRow.QUANTITY
        End Get
        Set(ByVal Value As System.Int32)
            Me.DataRow.QUANTITY = Value
        End Set
    End Property

    Public ReadOnly Property PurchaseOrderNumber() As String
        Get
            Try
                Dim objOrder As New COrder
                objOrder.Load(Me.PurchaseOrderID)
                Return objOrder.OrderNumber
            Catch ex As Exception
                Return Nothing
            End Try
        End Get        
    End Property
#End Region

End Class
